From 89522e69234ea448a45ad4c5153576982c382cd0 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 5 Sep 2018 06:33:12 +0200 Subject: [PATCH] iconhelper: Fix drawing of empty and paintable helpers Empty helpers did try to draw a NULL paintable (not good) and in the non-null case code used the wrong width/height. --- gtk/gtkiconhelper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 1c696a0d47..6b8f63e9ff 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -242,9 +242,13 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable, default: { double image_ratio = (double) width / height; - double ratio = gdk_paintable_get_intrinsic_aspect_ratio (self->paintable); + double ratio; double x, y, w, h; + if (self->paintable == NULL) + break; + + ratio = gdk_paintable_get_intrinsic_aspect_ratio (self->paintable); if (ratio == 0) { w = width; @@ -268,7 +272,7 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable, gtk_css_style_snapshot_icon_paintable (style, snapshot, self->paintable, - width, height, + w, h, self->texture_is_symbolic); gtk_snapshot_offset (snapshot, -x, -y); } -- 2.30.2